" fish

" Disable auto commenting {{{1
autocmd FileType conf setlocal formatoptions-=c formatoptions-=o formatoptions-=r

" colorcolumn 100 {{{1
autocmd FileType conf setlocal colorcolumn=100

" Set file type for fish shell scripts to be conf {{{1
autocmd BufNewFile,BufRead *.fish setlocal filetype=conf
autocmd BufNewFile,BufRead *fishrc* setlocal filetype=conf

" Clear whitespace on save {{{1
autocmd BufWritePre *.fish ClearWhitespace
autocmd BufWritePre *fishrc* ClearWhitespace

" fish function abbreviation {{{1
autocmd BufNewFile,BufRead,BufEnter *.fish inoreabbrev func type FUNCTION_NAME > /dev/null 2>&1;
  \or function FUNCTION_NAME
  \<cr>end<esc>k$*
autocmd BufNewFile,BufRead,BufEnter *fishrc* inoreabbrev func type FUNCTION_NAME > /dev/null 2>&1;
  \or function FUNCTION_NAME
  \<cr>end<esc>k$*

" unmap end when leaving
autocmd BufLeave *.fish silent! unabbreviate func
autocmd BufLeave *fishrc* silent! unabbreviate func

